package com.lhx.sort;

public class Insertion {
    public int[] InsertionSort(int[] a) {
        int temp = 0;
        for(int i=1; i<a.length; i++) {
            for(int j=i; j>0; j--) {
                if(a[j]<a[j-1]) {
                    temp = a[j];
                    a[j] = a[j-1];
                    a[j-1] = temp;
                }
            }
        }
        return a;
    }
}
